$(document).ready(function() {
	var peoId = $.cookie("peoId");
	$.fn.checkInit = function() {
		$.post("../../isLoginServlet", {
			"peoId": peoId
		}, function(ret) {
			if (ret != "null") {
				$("#peoId").html(ret);
			} else {
				$().showTips();
			};
		});
	};
	$().checkInit();
	$.fn.confirmLogin = function() {
		if (peoId == undefined) { //当服务器的peoId由于退出被设置成null时
			$().showTips();
		} else {
			$().checkInit();
		}
	};

	$.fn.showTips = function() {
		swal({
			title: "未登录",
			text: "您还没有登录，请登录后再进行操作！",
			type: "warning",
			showCancelButton: true,
			confirmButtonColor: "#DD6B55 !important",
			confirmButtonText: "登录",
			showCancelButton: false,
			closeOnConfirm: false,
			closeOnCancel: false
		}, function(isConfirm) {
			if (isConfirm) {
				$(location).attr('href', '../mylogin.html');
			}
		});
	};
	// var peoId = $.session.get('peoId');
	// var peoId = "<%=session.setAttribute('peoId')%>";
	$(document).mousedown(function() {
		$().confirmLogin();
	});


});
